package com.shiyingzi.gw.controller;


import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.shiyingzi.common.ResponseData;
import com.shiyingzi.gw.model.Setting;
import com.shiyingzi.gw.service.SettingService;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author fanbc
 * @since 2018-05-10
 */
@Controller
@RequestMapping("/setting")
public class SettingController {
	@Resource(name = SettingService.BEAN_ID)
	SettingService service;
	
	@RequestMapping(value = "/ainesrt", method = {RequestMethod.GET,RequestMethod.POST })
	public ResponseData inserNews(Setting code){
		return new ResponseData(service.insert(code),"添加成功"); 
	}


	
	@ResponseBody
	@RequestMapping(value = "/update", method = { RequestMethod.GET, RequestMethod.POST })
	public ResponseData update(Setting code){
		return new ResponseData(service.updateById(code),"修改产品"); 
	}
	
	@ResponseBody
	@RequestMapping(value = "/delete", method = { RequestMethod.GET, RequestMethod.POST })
	public ResponseData delete(Integer id){
		return new ResponseData(service.deleteById(id),"删除成功"); 
	}
	
	@ResponseBody
	@RequestMapping(value = "/queryById", method = { RequestMethod.GET, RequestMethod.POST })
	public ResponseData queryById(Integer id){
		return new ResponseData(true,"查询成功",service.selectById(id)); 
	}
}

